package com.edan.partnerback.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.edan.partnerback.common.LDTConfig;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
* <p>
* 
* </p>
*
* @author edan
* @since 2024-03-28
*/
@Getter
@Setter
@ApiModel(value = "Dynamic对象", description = "")
@TableName(autoResultMap = true)
public class Dynamic implements Serializable {

private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    // 标题
    @ApiModelProperty("标题")
    // @Alias("标题")
    private String name;

    // 文章
    @ApiModelProperty("文章")
    // @Alias("文章")
    private String content;

    // 图片
    @ApiModelProperty("图片")
    // @Alias("图片")
    private String imgs;

    // 描述
    @ApiModelProperty("描述")
    // @Alias("描述")
    private String description;

    // 创建时间
    @ApiModelProperty("创建时间")
    // @Alias("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonDeserialize(using = LDTConfig.CmzLdtDeSerializer.class)
    @JsonSerialize(using = LDTConfig.CmzLdtSerializer.class)
    private LocalDateTime createTime;

    // 更新时间
    @ApiModelProperty("更新时间")
    // @Alias("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonDeserialize(using = LDTConfig.CmzLdtDeSerializer.class)
    @JsonSerialize(using = LDTConfig.CmzLdtSerializer.class)
    private LocalDateTime updateTime;

    // 用户id
    @ApiModelProperty("用户id")
    // @Alias("用户id")
    private String uid;

    // 浏览次数
    @ApiModelProperty("浏览次数")
    // @Alias("浏览次数")
    private Integer views;
    // 浏览次数
    @ApiModelProperty("浏览次数")
    // @Alias("浏览次数")
    @TableField(exist = false)
    private Integer praise;
    // 点赞次数
    @ApiModelProperty("点赞次数")
    // @Alias("点赞次数")
    @TableField(exist = false)
    private Integer comment;

    @TableField(exist = false)
    private User user;

    @TableLogic(value = "0", delval = "id")
    private int deleted;

    @TableField(exist = false)
    private List<Praise> praises;

    @TableField(exist = false)
    private List<Comments> comments;

    @TableField(typeHandler = FastjsonTypeHandler.class)
    private List<String> tags;

    @TableField(exist = false)
    private Boolean isPraise;
    @TableField(exist = false)
    private Boolean isCollect;
}